package com.foomia.truego.types;

import com.foomia.truegoed.util.ParcelUtils;

import android.os.Parcel;
import android.os.Parcelable;

public class Venue implements TruegoType, Parcelable {
	private String mAddress;
	private Group<Checkin> mCheckins;
	private String mCity;
	private String mCityid;
	private String mCrossstreet;
	private String mDistance;
	private String mGeolat;
	private String mGeolong;
	private boolean mHasTodo;
	private String mId;
	private String mName;
	private String mPhone;
	private String mIcon;
	private String mState;
	private Stats mStats;
	private Tags mTags;
	private String mTwitter;
	private String mZip;

	private Types mTypes;
	private String mReference;
	private String mURL;

	public Venue() {
	}

	private Venue(Parcel in) {
		mAddress = ParcelUtils.readStringFromParcel(in);
		mCity = ParcelUtils.readStringFromParcel(in);
		mCityid = ParcelUtils.readStringFromParcel(in);
		mCrossstreet = ParcelUtils.readStringFromParcel(in);
		mDistance = ParcelUtils.readStringFromParcel(in);
		mGeolat = ParcelUtils.readStringFromParcel(in);
		mGeolong = ParcelUtils.readStringFromParcel(in);
		mHasTodo = in.readInt() == 1;
		mId = ParcelUtils.readStringFromParcel(in);
		mName = ParcelUtils.readStringFromParcel(in);
		mIcon = ParcelUtils.readStringFromParcel(in);
		mPhone = ParcelUtils.readStringFromParcel(in);
		mState = ParcelUtils.readStringFromParcel(in);
		mTwitter = ParcelUtils.readStringFromParcel(in);
		mZip = ParcelUtils.readStringFromParcel(in);
		mReference = ParcelUtils.readStringFromParcel(in);
		mURL = ParcelUtils.readStringFromParcel(in);
		mCheckins = new Group<Checkin>();
		int numCheckins = in.readInt();
		for (int i = 0; i < numCheckins; i++) {
			Checkin checkin = in.readParcelable(Checkin.class.getClassLoader());
			mCheckins.add(checkin);
		}

		int numSpecials = in.readInt();

		if (in.readInt() == 1) {
			mStats = in.readParcelable(Stats.class.getClassLoader());
		}

		mTags = new Tags();
		int numTags = in.readInt();
		for (int i = 0; i < numTags; i++) {
			String tag = in.readString();
			mTags.add(tag);
		}

		mTypes = new Types();
		int numTypes = in.readInt();
		for (int i = 0; i < numTags; i++) {
			String type = in.readString();
			mTypes.add(type);
		}
	}

	public static final Parcelable.Creator<Venue> CREATOR = new Parcelable.Creator<Venue>() {
		public Venue createFromParcel(Parcel in) {
			return new Venue(in);
		}

		@Override
		public Venue[] newArray(int size) {
			return new Venue[size];
		}
	};

	public String getAddress() {
		return mAddress;
	}

	public void setAddress(String address) {
		mAddress = address;
	}

	public Group<Checkin> getCheckins() {
		return mCheckins;
	}

	public void setCheckins(Group<Checkin> checkins) {
		mCheckins = checkins;
	}

	public String getCity() {
		return mCity;
	}

	public void setCity(String city) {
		mCity = city;
	}

	public String getCityid() {
		return mCityid;
	}

	public void setCityid(String cityid) {
		mCityid = cityid;
	}

	public String getCrossstreet() {
		return mCrossstreet;
	}

	public void setCrossstreet(String crossstreet) {
		mCrossstreet = crossstreet;
	}

	public String getDistance() {
		return mDistance;
	}

	public void setDistance(String distance) {
		mDistance = distance;
	}

	public String getGeolat() {
		return mGeolat;
	}

	public void setGeolat(String geolat) {
		mGeolat = geolat;
	}

	public String getGeolong() {
		return mGeolong;
	}

	public void setGeolong(String geolong) {
		mGeolong = geolong;
	}

	public boolean getHasTodo() {
		return mHasTodo;
	}

	public void setHasTodo(boolean hasTodo) {
		mHasTodo = hasTodo;
	}

	public String getId() {
		return mId;
	}

	public void setId(String id) {
		mId = id;
	}

	public String getName() {
		return mName;
	}

	public void setName(String name) {
		mName = name;
	}

	public String getIcon() {
		return mIcon;
	}

	public void setIcon(String icon) {
		mIcon = icon;
	}

	public String getPhone() {
		return mPhone;
	}

	public void setPhone(String phone) {
		mPhone = phone;
	}

	public String getState() {
		return mState;
	}

	public void setState(String state) {
		mState = state;
	}

	public Stats getStats() {
		return mStats;
	}

	public void setStats(Stats stats) {
		mStats = stats;
	}

	public Tags getTags() {
		return mTags;
	}

	public void setTags(Tags tags) {
		mTags = tags;
	}

	public String getTwitter() {
		return mTwitter;
	}

	public void setTwitter(String twitter) {
		mTwitter = twitter;
	}

	public String getZip() {
		return mZip;
	}

	public void setZip(String zip) {
		mZip = zip;
	}

	public String getReference() {
		return mReference;
	}

	public void setReference(String reference) {
		mReference = reference;
	}

	public String getURL() {
		return mURL;
	}

	public void setURL(String url) {
		mURL = url;
	}

	public Types getTypes() {
		return mTypes;
	}

	public void setTypes(Types types) {
		mTypes = types;
	}

	@Override
	public void writeToParcel(Parcel out, int flags) {
		ParcelUtils.writeStringToParcel(out, mAddress);
		ParcelUtils.writeStringToParcel(out, mCity);
		ParcelUtils.writeStringToParcel(out, mCityid);
		ParcelUtils.writeStringToParcel(out, mCrossstreet);
		ParcelUtils.writeStringToParcel(out, mDistance);
		ParcelUtils.writeStringToParcel(out, mGeolat);
		ParcelUtils.writeStringToParcel(out, mGeolong);
		out.writeInt(mHasTodo ? 1 : 0);
		ParcelUtils.writeStringToParcel(out, mId);
		ParcelUtils.writeStringToParcel(out, mName);
		ParcelUtils.writeStringToParcel(out, mIcon);
		ParcelUtils.writeStringToParcel(out, mPhone);
		ParcelUtils.writeStringToParcel(out, mState);
		ParcelUtils.writeStringToParcel(out, mTwitter);
		ParcelUtils.writeStringToParcel(out, mZip);
		ParcelUtils.writeStringToParcel(out, mReference);
		ParcelUtils.writeStringToParcel(out, mURL);
		if (mCheckins != null) {
			out.writeInt(mCheckins.size());
			for (int i = 0; i < mCheckins.size(); i++) {
				out.writeParcelable(mCheckins.get(i), flags);
			}
		} else {
			out.writeInt(0);
		}

		if (mStats != null) {
			out.writeInt(1);
			out.writeParcelable(mStats, flags);
		} else {
			out.writeInt(0);
		}

		if (mTags != null) {
			out.writeInt(mTags.size());
			for (int i = 0; i < mTags.size(); i++) {
				out.writeString(mTags.get(i));
			}
		} else {
			out.writeInt(0);
		}

		if (mTypes != null) {
			out.writeInt(mTypes.size());
			for (int i = 0; i < mTypes.size(); i++) {
				out.writeString(mTypes.get(i));
			}
		} else {
			out.writeInt(0);
		}
	}

	@Override
	public int describeContents() {
		return 0;
	}

}
